/*
 * Copyright (C) 2022 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef CATEGORYITEM_H
#define CATEGORYITEM_H

#include <QObject>
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
#include <QtQml/qqml.h>
#endif

class CategoryItemPrivate;
class CategoryItem : public QObject
{
    Q_OBJECT
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
    QML_ELEMENT
#endif
    Q_PROPERTY(int category READ category WRITE setCategory NOTIFY categoryChanged)
    Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
    Q_PROPERTY(QString normalIcon READ normalIcon WRITE setNormalIcon NOTIFY normalIconChanged)
    Q_PROPERTY(QString clickIcon READ clickIcon WRITE setClickIcon NOTIFY clickIconChanged)
    Q_PROPERTY(int pageCount READ pageCount WRITE setPageCount NOTIFY pageCountChanged)

public:
    enum Category {
        All,
        Android,
        Network,
        Messaging,
        Audio,
        Development,
        Graphics,
        Game,
        Office,
        Education,
        System,
        Safe,
        Other
    };
    Q_ENUM(Category)

    explicit CategoryItem(QObject *parent = nullptr);
    ~CategoryItem();

    int category() const;
    void setCategory(const int &category);

    QString name() const;
    void setName(const QString &name);

    QString normalIcon() const;
    void setNormalIcon(const QString &icon);

    QString clickIcon() const;
    void setClickIcon(const QString &icon);

    int pageCount() const;
    void setPageCount(const int &pageCount);

    static QString categoryToString(Category category);

Q_SIGNALS:
    void categoryChanged();
    void nameChanged();
    void iconChanged();
    void normalIconChanged();
    void clickIconChanged();
    void pageCountChanged();

private:
    CategoryItemPrivate *p;
};

#endif // CATEGORYITEM_H
